import EventBus from '@/event-bus/EventBus.js';
export default {
  props: ['isWidgetContainer', 'resizeEvtId'], // resizeEvtId: xvue-widget-container的widgetInstanceId
  data() {
    return {
      filterContainerWid: null,
    };
  },
  mounted() {
    this.checkIsInFilterContainer();
  },
  beforeUnmount() {
    if (this.filterContainerWid) {
      EventBus.$off(`emitEvent_blank${this.filterContainerWid}`);
    }
  },
  methods: {
    checkIsInFilterContainer() {
      if (!this.isWidgetContainer || !this.resizeEvtId) {
        return;
      }
      if (this.resizeEvtId.indexOf('_filterContainer') < 0) {
        return;
      }
      this.filterContainerWid = this.resizeEvtId.split('_filterContainer')[0];
      EventBus.$on(`emitEvent_blank${this.filterContainerWid}`, () => {
        this.emitBlankMsg && this.emitBlankMsg();
      });
    },
  },
};
